package mybatisTest.test.util;

import org.junit.Test;

import java.io.File;
//统计源代码的相关信息
public class FileOperation  {
    public static void main(String[] args) {
        File file=new File("D:\\temp\\spring-framework-4.3.18.RELEASE");
        File[] files = file.listFiles();
    }

    //删除文件目录下面所有的package-info.java
    public static void deleteFile(File file){
        if(file.isFile()){
            if(file.getName().equals("package-info.java")){
                file.delete();
            }
        }else if(file.isDirectory()){
            File[] files = file.listFiles();
            if(files!=null){
                for (File f:files){
                    deleteFile(f);
                }
            }
        }
    }

    public static int calClassCount(File file){
        if(file.isFile())return 1;
        File[] files = file.listFiles();
        int count=0;
        if(files!=null){
            for (File f:files){
                count+=calClassCount(f);
            }
        }
        return count;
    }


}
